(Quick Reference)
getDirtyPropertyNames
目的
Purpose
Retrieve the names of modified fields in a domain class instance.
使用例
Examples
def b = Book.get(1)
someMethodThatMightModifyTheInstance(b)def names = b.dirtyPropertyNames
for (name in names) {
def originalValue = b.getPersistentValue(name)
…
}
詳細
Description
This method is useful mostly for audit logging or other work done in a
beforeUpdate event callback. Hibernate caches the original state of all loaded instances for dirty checking during a flush and this method exposes the names of modified fields so you can compare them with the current state.